/*
 * Copyright © 2004-2014 chenYuan. All rights reserved.
 * @Website:wwww.jspx.net
 * @Mail:39793751@qq.com
 * @author: chenYuan , 陈原
 * @License: Jspx.net Framework Code is open source (LGPL)，Jspx.net Framework 使用LGPL 开源授权协议发布。
 * @jvm:jdk1.6+  x86/amd64
 *
 */
package com.jspx.sober.config;

import com.jspx.utils.StringUtil;
import com.jspx.sioc.util.TypeUtil;

import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User:chenYuan (mail:39793751@qq.com)
 * Date: 2007-1-6
 * Time: 22:17:10
 * 字段属性
 */
public class SoberColumn implements Serializable
{
    //字段名称
    private String name = StringUtil.empty;
    //类型
    private Class classType;
    //是否空
    private boolean notNull = false;
    //默认值
    private String defaultValue = StringUtil.empty;
    //描述
    private String caption = null;
    //选项
    private String option = null;
    //验证
    private String dataType = null;
    //输入框
    private String input = "text";
    //长度
    private int length = 0;
    //true 的时候导出屏蔽
    private boolean hidden = false;


    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }

    public String getDataType()
    {
        return dataType;
    }

    public void setDataType(String dataType)
    {
        this.dataType = dataType;
    }

    public int getLength()
    {
        return length;
    }

    public void setLength(int length)
    {
        this.length = length;
    }

    public String getType()
    {
        return TypeUtil.getTypeString(classType);
    }

    public Class getClassType()
    {
        return classType;
    }

    public void setClassType(Class classType)
    {
        this.classType = classType;
    }


    public boolean isNotNull()
    {
        return notNull;
    }

    public void setNotNull(boolean notNull)
    {
        this.notNull = notNull;
    }


    public String getDefaultValue()
    {
        if (defaultValue == null) return StringUtil.empty;
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue)
    {
        this.defaultValue = defaultValue;
    }


    public String getCaption()
    {
        if (StringUtil.isNULL(caption)) return name;
        return caption;
    }

    public void setCaption(String caption)
    {
        this.caption = caption;
    }


    public String getOption()
    {
        return option;
    }

    public void setOption(String option)
    {
        this.option = option;
    }

    public String getInput() {
        return input;
    }

    public void setInput(String input) {
        this.input = input;
    }

    public boolean isHidden() {
        return hidden;
    }

    public void setHidden(boolean hidden) {
        this.hidden = hidden;
    }
}